/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.repair.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.repair.entity.MaintainPlanContentUser;
import org.springblade.modules.repair.vo.MaintainPlanContentUserVO;
import org.springblade.modules.repair.vo.PlanUserVO;
import org.springblade.modules.repair.vo.plan.wx.PlanMaintainUserVO;

import java.util.Date;
import java.util.List;

/**
 * 维保任务关联人员中间表 服务类
 *
 * @author BladeX
 * @since 2021-05-21
 */
public interface IMaintainPlanContentUserService extends BaseService<MaintainPlanContentUser> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param maintainPlanContentUser
	 * @return
	 */
	IPage<MaintainPlanContentUserVO> selectMaintainPlanContentUserPage(IPage<MaintainPlanContentUserVO> page, MaintainPlanContentUserVO maintainPlanContentUser);

    List<PlanUserVO> listUserByPlanId(Long planId);

	/**
	 * 更新用户的签到信息
	 * @param planId 任务id
	 * @param signType 1:签到,2：签退 对应SignEnum
	 * @param userId 用户id
	 * @param signStatus 用户签到状态
	 */
	void updatePlanUserSignInfo(Long planId, Integer signType, Long userId, Integer signStatus);

	List<MaintainPlanContentUser> listUserByPlan(Long planId);

	List<String> listPlanUserDept(List<Long> userIds);


	/**
	 * 批量添加工单关联人
	 * @param planId 工单id
	 * @param userIds 用户ids
	 * @param planArriveDate
	 * @return 数据集
	 */
	boolean saveBatch(Long planId, List<Long> userIds, Date planArriveDate);

    String getPlanUserName(Long planId);

	/**
	 * 处理计划人与实际执行人
	 * @param planId
	 * @return
	 */
    Boolean changePlanUser(Long planId);

	Boolean changeAllPlanUser();

	/**
	 * @Date 9:53 2023/3/1
	 * @Description {
	 *   更新工单用户的签到信息，并返回实际作业人
	 * }
	 * @Author lsay
	 **/
	List<MaintainPlanContentUser> updateRescuePlanUserSignInfo(Long planId);

    MaintainPlanContentUser getLastPlanUser(Long planId, Long userId);

	void updateIsDeletedById(Long id, Integer isDeleted);

	List<MaintainPlanContentUser> listUserByPlanIds(List<Long> planIds);

    List<PlanMaintainUserVO> selectWorkUsers(Long planId);
}
